﻿using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations;

using Comswing.Business.Entities;

namespace Comswing.Data.Configuration
{
    internal class OrganizationConfiguration : EntityTypeConfiguration<Organization>
    {
        public OrganizationConfiguration()
        {
            HasKey(e => e.Id);

            Property(e => e.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .HasColumnName("Id");

            Property(e => e.Name)
                .IsRequired()
                .IsUnicode(false)
                .HasMaxLength(60)
                .HasColumnName("Name");

            Property(e => e.Description)
                .IsOptional()
                .IsMaxLength()
                .HasColumnName("Description");

            ToTable("Organization", "dbo");
        }
    }
}
